thin.define(function(exports) {
	var self = this;

	// 获取期号
	function main(complete) {
		var url = thin.extData.origin + '/lottery/getNextIssue.do';
		var data_opt = {
			'_t': Date.now(),
			'gameId': thin.store_bets.gameId
		};
		var again = 5;
		request();

		function request() {
			thin.ajax.get(url, data_opt, function(res) {
				if (res.state) {
					complete(res.data.issue);
				} else {
					// 获取期号失败
					if (again > 0) {
						setTimeout(request, 1.6 * 1000);
						--again;
					} else {
						complete();
					}
				}
			});
		}
	}

	exports('requestIssue', main);
});
